﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Restaurant.Business;
using Restaurant.Model;
using Restaurant.Common;
using Restaurant.Model.ExModel;

namespace Restaurant.Site
{
    public class FoodSite
    {

        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="subId"></param>
        /// <returns></returns>
        public async Task<OperationResult> GetAllFoodTypeAndFoodAsync(Guid subId)
        {
            if (null == subId || new Guid() == subId)
                return new OperationResult(OperationResultType.Error, "公司ID不能为空");

            FoodBusiness foodTypeBusiness = new FoodBusiness();

            return await foodTypeBusiness.GetAllFoodTypeAndFoodAsync(subId);

        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<OperationResult> AddModeExAsync(FoodType_Food_Ex model)
        {
            if (string.IsNullOrEmpty(model.FoodTypeName) || null == model.SubCompany_Id || new Guid() == model.SubCompany_Id)
                return new OperationResult(OperationResultType.ParamError, "参数有误");

            

            return await new FoodBusiness().AddModeExAsync (model);
        }

        public async Task<OperationResult> DeleteAsync(long id)
        {
            if (id < 1)
                return new OperationResult(OperationResultType.Error, "id错误");

            FoodBusiness foodTypeBusiness = new FoodBusiness();

            return await foodTypeBusiness.DeleteAsync(id);
        }
    }
}
